import java.io.*;

import java.io.BufferedInputStream;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.RandomAccessFile;
import java.nio.file.attribute.DosFileAttributes;
import java.text.FieldPosition;
import java.util.List;
import java.util.stream.*;

import javax.xml.crypto.Data;

public class file {
    File file = new File("a");

    String filename = file.getName();

    FileInputStream fis = new FileInputStream(File file);

    public void traverse(File file){
        if(file.isDirectory()){
            File[] children = file.listFiles();

            for(int i = 0;i < children.length;i++){
                traverse(children[i]);
            }
        }else{
            System.out.println(file.getCanonicalPath());
            list.add(file);
        }
    }
}

public class DecryptedInputStream extends InputStream{
    private InputStream in;
    byte[] buffer = new byte[8192];
    public DecryptedInputStream(InputStream in){
        this.in = in;
    }
    

    public int read(byte[] data) throws  IOException{
        return read(data,0,data.length);
    }
    public int read() throws IOException{
        int c = in.read();
        if(c == -1){
            return c;
        }else{
            c = ~c;
            return c;
        }
    }

}

public class ReadData{
    public static void main(String[] args) {
        try {
            FileInputStream fis = new FileInputStream(args[0]);
            BufferedInputStream bis = new BufferedInputStream(fis);
            DecryptedInputStream dis2 = new DecryptedInputStream(bis);

            DataInputStream dis = new DataInputStream(bis);

            for(int i = 0; i < 100; i++){
                dis.readInt(i);
                dis.readDouble(Math.random());
            }

            fis.close();
            bis.close();
            dis.close();
        } catch (Exception e) {
        }
    }
}


//试试
public class Copy{
    public static void main(String[] args) {
        try {
            FileInputStream fis = new FileInputStream(args[0]);
            FileOutputStream fos = new FileOutputStream(args[1]);

            int c = 0;
            byte[] buffer = new byte[8*1024];
            while((c = fis.read(buffer)) != -1){
                fos.write(buffer,0,c);
            }
            fis.close();
            fos.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

public class Type{
    public static void main(String[] args) {
        try {
            FileReader fr = new FileReader(args[0]);
            BufferedReader br = new BufferedReader(fr);
            String line;
            while((line = br.readLine()) != null){
                System.out.println(line);
            }
            br.close();
            fr.close();
            
            int c = 0;

            while((c = fr.read()) != -1){
                System.out.println((char)c);
            }
            fr.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}



































































,

















